package dao.domain;


/**
 * @author huangzhiyang
 * @Date 2023/9/19 图书类
 * 属性：书号，名称，作者，出版商，价格，数量，是否被借阅，是否已卖出
 * 业务：
 */
public class Book {
    /**
     * 书号
     */
    private final int number;
    /**
     * 价格
     */
    private final double price;
    /**
     * 名称
     */
    private String name = null;
    /**
     * 作者
     */
    private String author = null;
    /**
     * 出版商
     */
    private String publisher = null;
    /**
     * 数量
     */
    private int quantity;

    /**
     * 是否被借阅
     */
    private boolean isBorrow;
    /**
     * 是否已卖出
     */
    private boolean isSell;

    public Book(int number, String name, String author, String publisher, double price, int quantity) {
        this.number = number;
        this.name = name;
        this.author = author;
        this.publisher = publisher;
        this.price = price;
        this.quantity = quantity;
        this.isBorrow = false;
        this.isSell = false;

    }

    public Book(int number, String name, String author, String publisher, double price, int quantity, boolean isBorrow, boolean isSell) {
        this.number = number;
        this.name = name;
        this.author = author;
        this.publisher = publisher;
        this.price = price;
        this.quantity = quantity;
        this.isBorrow = isBorrow;
        this.isSell = isSell;
    }

    public Book(int number, String name, String author, String publisher, Integer quantity, Double price) {
        this.number = number;
        this.name = name;
        this.author = author;
        this.publisher = publisher;
        this.price = price;
        this.quantity = quantity;
    }

    public Book() {
        this.number = -1;
        this.price = -1;
        this.quantity = -1;
    }


    public boolean isBorrow() {
        return isBorrow;
    }

    public void setBorrow(boolean borrow) {
        isBorrow = borrow;

    }

    public boolean isSell() {
        return isSell;
    }

    public void setSell(boolean sell) {
        isSell = sell;

    }


    @Override
    public String toString() {

        return "书号：" + number + "\t" + "书名：" + name + "\t" + "作者：" + author + "\t" + "出版商：" + publisher + "\t" + "价格：" + price + "\t" +
                "数量：" + quantity + "\t" + "是否借出：" + isBorrow + "\t" + "是否卖出：" + isSell;
    }

    public int getNumber() {
        return number;
    }

    public String getName() {
        return name;
    }

    public String getAuthor() {
        return author;
    }

    public String getPublisher() {
        return publisher;
    }

    public double getPrice() {
        return price;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }


}
